moved user css setup to skinphptal, no hardcoded ?
[lhc/web/wiklou.git] / includes / SkinPHPTal.php
1 <?php
2 # Generic PHPTal (http://phptal.sourceforge.net/) skin
3 # Based on Brion's smarty skin
4 # Copyright (C) Gabriel Wicke -- http://www.aulinx.de/
5 #
6 # Todo: Needs some serious refactoring into functions that correspond
7 # to the computations individual esi snippets need. Most importantly no body
8 # parsing for most of those of course.
9 #
10 # Set this in LocalSettings to enable phptal:
11 # set_include_path(get_include_path() . ":" . $IP.'/PHPTAL-NP-0.7.0/libs');
12 # $wgUsePHPTal = true;
13 #
14 # This program is free software; you can redistribute it and/or modify
15 # it under the terms of the GNU General Public License as published by
16 # the Free Software Foundation; either version 2 of the License, or
17 # (at your option) any later version.
18 #
19 # This program is distributed in the hope that it will be useful,
20 # but WITHOUT ANY WARRANTY; without even the implied warranty of
21 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 # GNU General Public License for more details.
23 #
24 # You should have received a copy of the GNU General Public License along
25 # with this program; if not, write to the Free Software Foundation, Inc.,
26 # 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
27 # http://www.gnu.org/copyleft/gpl.html
28
29 require_once "PHPTAL.php";
30
31 class MediaWiki_I18N extends PHPTAL_I18N
32 {
33 var $_context = array();
34
35 function set($varName, $value) {
36 $this->_context[$varName] = $value;
37 }
38
39 function translate($value) {
40 $value = wfMsg( $value );
41 // interpolate variables
42 while (preg_match('/\$([0-9]*?)/sm', $value, $m)) {
43 list($src, $var) = $m;
44 $varValue = @$this->_context[$var];
45 $value = str_replace($src, $varValue, $value);
46 }
47 return $value;
48 }
49 }
50
51 class SkinPHPTal extends Skin {
52 var $template;
53
54 function initPage( &$out ) {
55 parent::initPage( $out );
56 $this->skinname = "davinci";
57 $this->template = "xhtml_slim";
58 }
59
60 function outputPage( &$out ) {
61 global $wgTitle, $wgArticle, $wgUser, $wgLang, $wgOut;
62 global $wgScript, $wgStylePath, $wgLanguageCode, $wgUseNewInterlanguage;
63 global $wgMimeType, $wgOutputEncoding, $wgUseDatabaseMessages, $wgRequest;
64 global $wgDisableCounters, $wgLogo, $action, $wgFeedClasses;
65
66 extract( $wgRequest->getValues( 'oldid', 'diff' ) );
67
68 $this->initPage( $out );
69 $tpl = new PHPTAL($this->template . '.pt', 'templates');
70
71 #if ( $wgUseDatabaseMessages ) { // uncomment this to fall back to GetText
72 $tpl->setTranslator(new MediaWiki_I18N());
73 #}
74
75 $this->thispage = $wgTitle->getPrefixedDbKey();
76 $this->thisurl = $wgTitle->getPrefixedURL();
77 $this->thisurle = urlencode($this->thisurl);
78 $this->loggedin = $wgUser->getID() != 0;
79 $this->username = $wgUser->getName();
80 $this->userpage = $wgLang->getNsText( Namespace::getUser() ) . ":" . $wgUser->getName();
81 $this->userpageurl = $this->makeUrl($this->userpage);
82
83 if( $this->loggedin ) {
84 $this->usercss = $this->makeUrl($this->userpage.'/'.$this->skinname.'.css', 'action=raw&ctype=text/css');
85 $this->usercsse = htmlspecialchars($this->usercss);
86 $this->userjs = $this->makeUrl($this->userpage.'/'.$this->skinname.'.js', 'action=raw&ctype=text/javascript');
87 $this->userjse = htmlspecialchars($this->userjs);
88 } else {
89 $this->usercss = $this->usercsse = $this->userjs = $this->userjse = false;
90 }
91 $this->titletxt = $wgTitle->getPrefixedText();
92
93 $tpl->set( "title", $wgOut->getPageTitle() );
94 $tpl->set( "pagetitle", $wgOut->getHTMLTitle() );
95
96 $tpl->setRef( "thispage", &$this->thispage );
97 $subpagestr = $this->subPageSubtitle();
98 $tpl->set(
99 "subtitle", !empty($subpagestr)?
100 '<span class="subpages">'.$subpagestr.'</span>'.$out->getSubtitle():
101 $out->getSubtitle()
102 );
103 $tpl->set( 'catlinks', $this->getCategories());
104 if( $wgOut->isSyndicated() ) {
105 $feeds = array();
106 foreach( $wgFeedClasses as $format => $class ) {
107 $feeds[$format] = array(
108 'text' => $format,
109 'href' => $wgRequest->appendQuery( "feed=$format" ),
110 'ttip' => wfMsg('tooltip-'.$format)
111 );
112 }
113 $tpl->setRef( 'feeds', &$feeds );
114 }
115 $tpl->setRef( 'mimetype', &$wgMimeType );
116 $tpl->setRef( 'charset', &$wgOutputEncoding );
117 $tpl->set( 'headlinks', $out->getHeadLinks() );
118 $tpl->setRef( 'skinname', &$this->skinname );
119 $tpl->setRef( "loggedin", &$this->loggedin );
120 /* XXX currently unused, might get useful later
121 $tpl->set( "editable", ($wgTitle->getNamespace() != NS_SPECIAL ) );
122 $tpl->set( "exists", $wgTitle->getArticleID() != 0 );
123 $tpl->set( "watch", $wgTitle->userIsWatching() ? "unwatch" : "watch" );
124 $tpl->set( "protect", count($wgTitle->getRestrictions()) ? "unprotect" : "protect" );
125 $tpl->set( "helppage", wfMsg('helppage'));
126 $tpl->set( "sysop", $wgUser->isSysop() );
127 */
128 $tpl->set( "searchaction", $this->escapeSearchLink() );
129 $tpl->setRef( "stylepath", &$wgStylePath );
130 $tpl->setRef( "logopath", &$wgLogo );
131 $tpl->setRef( "lang", &$wgLanguageCode );
132 $tpl->set( "dir", $wgLang->isRTL() ? "rtl" : "ltr" );
133 $tpl->set( "rtl", $wgLang->isRTL() );
134 $tpl->set( "langname", $wgLang->getLanguageName( $wgLanguageCode ) );
135 $tpl->setRef( "username", &$this->username );
136 $tpl->setRef( "userpage", &$this->userpage);
137 $tpl->setRef( "userpageurl", &$this->userpageurl);
138 $tpl->setRef( "usercss", &$this->usercss);
139 $tpl->setRef( "usercsse", &$this->usercsse);
140 $tpl->setRef( "userjs", &$this->userjs);
141 $tpl->setRef( "userjse", &$this->userjse);
142 if( $wgUser->getNewtalk() ) {
143 $usertitle = Title::newFromText( $this->userpage );
144 $usertalktitle = $usertitle->getTalkPage();
145 if($usertalktitle->getPrefixedDbKey() != $this->thispage){
146
147 $ntl = wfMsg( "newmessages",
148 $this->makeKnownLink(
149 $wgLang->getNsText( Namespace::getTalk( Namespace::getUser() ) )
150 . ":" . $this->username,
151 wfMsg("newmessageslink") )
152 );
153 }
154 } else {
155 $ntl = "";
156 }
157
158 $tpl->setRef( "newtalk", &$ntl );
159 $tpl->setRef( "skin", &$this);
160 $tpl->set( "logo", $this->logoText() );
161 if ( $wgOut->isArticle() and (!isset( $oldid ) or isset( $diff )) and 0 != $wgArticle->getID() ) {
162 if ( !$wgDisableCounters ) {
163 $viewcount = $wgLang->formatNum( $wgArticle->getCount() );
164 if ( $viewcount ) {
165 $tpl->set('viewcount', wfMsg( "viewcount", $viewcount ));
166 }
167 }
168 $tpl->set('lastmod', $this->lastModified());
169 $tpl->set('copyright',$this->getCopyright());
170 }
171 $tpl->set( "copyrightico", $this->getCopyrightIcon() );
172 $tpl->set( "poweredbyico", $this->getPoweredBy() );
173 $tpl->set( "disclaimer", $this->disclaimerLink() );
174 $tpl->set( "about", $this->aboutLink() );
175
176 $tpl->setRef( "debug", &$out->mDebugtext );
177 $tpl->set( "reporttime", $out->reportTime() );
178
179 $tpl->setRef( "bodytext", &$out->mBodytext );
180
181 $language_urls = array();
182 foreach( $wgOut->getLanguageLinks() as $l ) {
183 $nt = Title::newFromText( $l );
184 $language_urls[] = array('href' => $nt->getFullURL(),
185 'text' => ($wgLang->getLanguageName( $nt->getInterwiki()) != ''?$wgLang->getLanguageName( $nt->getInterwiki()) : $l),
186 'class' => $wgLang->isRTL() ? 'rtl' : 'ltr');
187 }
188 if(count($language_urls)) {
189 $tpl->setRef( 'language_urls', &$language_urls);
190 } else {
191 $tpl->set('language_urls', false);
192 }
193 $tpl->set('personal_urls', $this->buildPersonalUrls());
194 $content_actions = $this->buildContentActionUrls();
195 $tpl->setRef('content_actions', &$content_actions);
196 // XXX: attach this from javascript, same with section editing
197 if(isset($content_actions['edit']['href']) &&
198 !(isset($content_actions['edit']['class']) && $content_actions['edit']['class'] != '') &&
199 $wgUser->getOption("editondblclick") )
200 {
201 $tpl->set('body-ondblclick', 'document.location = "' .$content_actions['edit']['href'] .'";');
202 } else {
203 $tpl->set('body-ondblclick', '');
204 }
205 $tpl->set( "nav_urls", $this->buildNavUrls() );
206
207 // execute template
208 $res = $tpl->execute();
209 // result may be an error
210 if (PEAR::isError($res)) {
211 echo $res->toString(), "\n";
212 } else {
213 echo $res;
214 }
215
216 }
217
218 # build array of urls for personal toolbar
219 function buildPersonalUrls() {
220 /* set up the default links for the personal toolbar */
221 global $wgShowIPinHeader;
222 $personal_urls = array();
223 if ($this->loggedin) {
224 $personal_urls['userpage'] = array(
225 'text' => $this->username,
226 'href' => &$this->userpageurl,
227 'ttip' => wfMsg('tooltip-userpage'),
228 'akey' => wfMsg('accesskey-userpage')
229 );
230 $personal_urls['mytalk'] = array(
231 'text' => wfMsg('mytalk'),
232 'href' => $this->makeTalkUrl($this->userpage),
233 'ttip' => wfMsg('tooltip-mytalk'),
234 'akey' => wfMsg('accesskey-mytalk')
235 );
236 $personal_urls['preferences'] = array(
237 'text' => wfMsg('preferences'),
238 'href' => $this->makeSpecialUrl('Preferences'),
239 'ttip' => wfMsg('tooltip-preferences'),
240 'akey' => wfMsg('accesskey-preferences')
241 );
242 $personal_urls['watchlist'] = array(
243 'text' => wfMsg('watchlist'),
244 'href' => $this->makeSpecialUrl('Watchlist'),
245 'ttip' => wfMsg('tooltip-watchlist'),
246 'akey' => wfMsg('accesskey-watchlist')
247 );
248 $personal_urls['mycontris'] = array(
249 'text' => wfMsg('mycontris'),
250 'href' => $this->makeSpecialUrl('Contributions','target=' . $this->username),
251 'ttip' => wfMsg('tooltip-mycontris'),
252 'akey' => wfMsg('accesskey-mycontris')
253 );
254 $personal_urls['logout'] = array(
255 'text' => wfMsg('userlogout'),
256 'href' => $this->makeSpecialUrl('Userlogout','returnpage=' . $this->thisurle),
257 'ttip' => wfMsg('tooltip-logout'),
258 'akey' => wfMsg('accesskey-logout')
259 );
260 } else {
261 if( $wgShowIPinHeader && isset( $_COOKIE[ini_get("session.name")] ) ) {
262 $personal_urls['anonuserpage'] = array(
263 'text' => $this->username,
264 'href' => $this->makeUrl($this->userpage),
265 'ttip' => wfMsg('tooltip-anonuserpage'),
266 'akey' => wfMsg('accesskey-anonuserpage')
267 );
268 $personal_urls['anontalk'] = array(
269 'text' => wfMsg('anontalk'),
270 'href' => $this->makeTalkUrl($this->userpage),
271 'ttip' => wfMsg('tooltip-anontalk'),
272 'akey' => wfMsg('accesskey-anontalk')
273 );
274 $personal_urls['anonlogin'] = array(
275 'text' => wfMsg('userlogin'),
276 'href' => $this->makeSpecialUrl('Userlogin', 'return='.$this->thisurle),
277 'ttip' => wfMsg('tooltip-login'),
278 'akey' => wfMsg('accesskey-login')
279 );
280 } else {
281
282 $personal_urls['login'] = array(
283 'text' => wfMsg('userlogin'),
284 'href' => $this->makeSpecialUrl('Userlogin', 'return='.$this->thisurle),
285 'ttip' => wfMsg('tooltip-login'),
286 'akey' => wfMsg('accesskey-login')
287 );
288 }
289 }
290
291 return $personal_urls;
292 }
293
294 # an array of edit links by default used for the tabs
295 function buildContentActionUrls () {
296 global $wgTitle, $wgUser, $wgRequest;
297 $action = $wgRequest->getText( 'action' );
298 $oldid = $wgRequest->getVal( 'oldid' );
299 $diff = $wgRequest->getVal( 'diff' );
300 $content_actions = array();
301
302 $iscontent = ($wgTitle->getNamespace() != Namespace::getSpecial() );
303 if( $iscontent) {
304
305 $content_actions['article'] = array('class' => (!Namespace::isTalk( $wgTitle->getNamespace())) ? 'selected' : '',
306 'text' => wfMsg('article'),
307 'href' => $this->makeArticleUrl($this->thispage),
308 'ttip' => wfMsg('tooltip-article'),
309 'akey' => wfMsg('accesskey-article'));
310
311 /* set up the classes for the talk link */
312 $talk_class = (Namespace::isTalk( $wgTitle->getNamespace()) ? 'selected' : '');
313 $talktitle = Title::newFromText( $this->titletxt );
314 $talktitle = $talktitle->getTalkPage();
315 $this->checkTitle(&$talktitle, &$this->titletxt);
316 if($talktitle->getArticleId() != 0) {
317 $content_actions['talk'] = array(
318 'class' => $talk_class,
319 'text' => wfMsg('talk'),
320 'href' => $this->makeTalkUrl($this->titletxt),
321 'ttip' => wfMsg('tooltip-talk'),
322 'akey' => wfMsg('accesskey-talk')
323 );
324 } else {
325 $content_actions['talk'] = array(
326 'class' => $talk_class?$talk_class.' new':'new',
327 'text' => wfMsg('talk'),
328 'href' => $this->makeTalkUrl($this->titletxt,'action=edit'),
329 'ttip' => wfMsg('tooltip-talk'),
330 'akey' => wfMsg('accesskey-talk')
331 );
332 }
333
334 if ( $wgTitle->userCanEdit() ) {
335 $oid = ( $oldid && ! isset( $diff ) ) ? "&oldid={$oldid}" : '';
336 $content_actions['edit'] = array(
337 'class' => ($action == 'edit' or $action == 'submit') ? 'selected' : '',
338 'text' => wfMsg('edit'),
339 'href' => $this->makeUrl($this->thispage, 'action=edit'.$oid),
340 'ttip' => wfMsg('tooltip-edit'),
341 'akey' => wfMsg('accesskey-edit')
342 );
343 } else {
344 $oid = ( $oldid && ! isset( $diff ) ) ? "&oldid={$oldid}" : '';
345 $content_actions['edit'] = array('class' => ($action == 'edit') ? 'selected' : '',
346 'text' => wfMsg('viewsource'),
347 'href' => $this->makeUrl($this->thispage, 'action=edit'.$oid),
348 'ttip' => wfMsg('tooltip-viewsource'),
349 'akey' => wfMsg('accesskey-viewsource'));
350 }
351
352 if ( $wgTitle->getArticleId() ) {
353
354 $content_actions['history'] = array('class' => ($action == 'history') ? 'selected' : '',
355 'text' => wfMsg('history_short'),
356 'href' => $this->makeUrl($this->thispage, 'action=history'),
357 'ttip' => wfMsg('tooltip-history'),
358 'akey' => wfMsg('accesskey-history'));
359
360 # XXX: is there a rollback action anywhere or is it planned?
361 # Don't recall where i got this from...
362 /*if( $wgUser->getNewtalk() ) {
363 $content_actions['rollback'] = array('class' => ($action == 'rollback') ? 'selected' : '',
364 'text' => wfMsg('rollback_short'),
365 'href' => $this->makeUrl($this->thispage, 'action=rollback'),
366 'ttip' => wfMsg('tooltip-rollback'),
367 'akey' => wfMsg('accesskey-rollback'));
368 }*/
369
370 if($wgUser->isSysop()){
371 if(!$wgTitle->isProtected()){
372 $content_actions['protect'] = array(
373 'class' => ($action == 'protect') ? 'selected' : '',
374 'text' => wfMsg('protect'),
375 'href' => $this->makeUrl($this->thispage, 'action=protect'),
376 'ttip' => wfMsg('tooltip-protect'),
377 'akey' => wfMsg('accesskey-protect')
378 );
379
380 } else {
381 $content_actions['unprotect'] = array(
382 'class' => ($action == 'unprotect') ? 'selected' : '',
383 'text' => wfMsg('unprotect'),
384 'href' => $this->makeUrl($this->thispage, 'action=unprotect'),
385 'ttip' => wfMsg('tooltip-protect'),
386 'akey' => wfMsg('accesskey-protect')
387 );
388 }
389 $content_actions['delete'] = array(
390 'class' => ($action == 'delete') ? 'selected' : '',
391 'text' => wfMsg('delete'),
392 'href' => $this->makeUrl($this->thispage, 'action=delete'),
393 'ttip' => wfMsg('tooltip-delete'),
394 'akey' => wfMsg('accesskey-delete')
395 );
396 }
397 if ( $wgUser->getID() != 0 ) {
398 if ( $wgTitle->userCanEdit()) {
399 $content_actions['move'] = array('class' => ($wgTitle->getDbKey() == 'Movepage' and $wgTitle->getNamespace == Namespace::getSpecial()) ? 'selected' : '',
400 'text' => wfMsg('move'),
401 'href' => $this->makeSpecialUrl('Movepage', 'target='.$this->thispage),
402 'ttip' => wfMsg('tooltip-move'),
403 'akey' => wfMsg('accesskey-move'));
404 } else {
405 $content_actions['move'] = array('class' => 'inactive',
406 'text' => wfMsg('move'),
407 'href' => false,
408 'ttip' => wfMsg('tooltip-nomove'),
409 'akey' => false);
410
411 }
412 }
413 } else {
414 //article doesn't exist or is deleted
415 if($wgUser->isSysop()){
416 if( $n = $wgTitle->isDeleted() ) {
417 $content_actions['delete'] = array(
418 'class' => '',
419 'text' => wfMsg( "undelete_short", $n ),
420 'href' => $this->makeSpecialUrl('Undelete/'.$this->thispage),
421 'ttip' => wfMsg('tooltip-undelete', $n),
422 'akey' => wfMsg('accesskey-undelete')
423 );
424 }
425 }
426 }
427
428 if ( $wgUser->getID() != 0 and $action != 'edit' and $action != 'submit' ) {
429 if( !$wgTitle->userIsWatching()) {
430 $content_actions['watch'] = array('class' => ($action == 'watch' or $action == 'unwatch') ? 'selected' : '',
431 'text' => wfMsg('watch'),
432 'href' => $this->makeUrl($this->thispage, 'action=watch'),
433 'ttip' => wfMsg('tooltip-watch'),
434 'akey' => wfMsg('accesskey-watch'));
435 } else {
436 $content_actions['watch'] = array('class' => ($action == 'unwatch' or $action == 'watch') ? 'selected' : '',
437 'text' => wfMsg('unwatch'),
438 'href' => $this->makeUrl($this->thispage, 'action=unwatch'),
439 'ttip' => wfMsg('tooltip-unwatch'),
440 'akey' => wfMsg('accesskey-unwatch'));
441
442 }
443 }
444 } else {
445 /* show special page tab */
446
447 $content_actions['article'] = array('class' => 'selected',
448 'text' => wfMsg('specialpage'),
449 'href' => false,
450 'ttip' => wfMsg('tooltip-specialpage'),
451 'akey' => false);
452 }
453
454 return $content_actions;
455 }
456
457 # build array of common navigation links
458 function buildNavUrls () {
459 global $wgTitle, $wgUser, $wgRequest;
460 global $wgSiteSupportPage;
461
462 $action = $wgRequest->getText( 'action' );
463 $oldid = $wgRequest->getVal( 'oldid' );
464 $diff = $wgRequest->getVal( 'diff' );
465 // XXX: remove htmlspecialchars when tal:attributes works with i18n:attributes
466 $nav_urls = array();
467 $nav_urls['mainpage'] = array('href' => htmlspecialchars( $this->makeI18nUrl('mainpage')));
468 $nav_urls['randompage'] = array('href' => htmlspecialchars( $this->makeSpecialUrl('Randompage')));
469 $nav_urls['recentchanges'] = array('href' => htmlspecialchars( $this->makeSpecialUrl('Recentchanges')));
470 $nav_urls['whatlinkshere'] = array('href' => htmlspecialchars( $this->makeSpecialUrl('Whatlinkshere', 'target='.$this->thispage)));
471 $nav_urls['currentevents'] = (wfMsg('currentevents') != '-') ? array('href' => htmlspecialchars( $this->makeI18nUrl('currentevents'))) : '';
472 $nav_urls['portal'] = (wfMsg('portal') != '-') ? array('href' => htmlspecialchars( $this->makeI18nUrl('portal-url'))) : '';
473 $nav_urls['recentchangeslinked'] = array('href' => htmlspecialchars( $this->makeSpecialUrl('Recentchangeslinked', 'target='.$this->thispage)));
474 $nav_urls['bugreports'] = array('href' => htmlspecialchars( $this->makeI18nUrl('bugreportspage')));
475 // $nav_urls['sitesupport'] = array('href' => htmlspecialchars( $this->makeI18nUrl('sitesupportpage')));
476 $nav_urls['sitesupport'] = array('href' => htmlspecialchars( $wgSiteSupportPage));
477 $nav_urls['help'] = array('href' => htmlspecialchars( $this->makeI18nUrl('helppage')));
478 $nav_urls['upload'] = array('href' => htmlspecialchars( $this->makeSpecialUrl('Upload')));
479 $nav_urls['specialpages'] = array('href' => htmlspecialchars( $this->makeSpecialUrl('Specialpages')));
480
481
482 $id=User::idFromName($wgTitle->getText());
483 $ip=User::isIP($wgTitle->getText());
484
485 if($id || $ip) { # both anons and non-anons have contri list
486 $nav_urls['contributions'] = array(
487 'href' => htmlspecialchars( $this->makeSpecialUrl('Contributions', "target=" . $wgTitle->getPartialURL() ) )
488 );
489 }
490 if ( 0 != $wgUser->getID() ) { # show only to signed in users
491 if($id) { # can only email non-anons
492 $nav_urls['emailuser'] = array(
493 'href' => htmlspecialchars( $this->makeSpecialUrl('Emailuser', "target=" . $wgTitle->getPartialURL() ) )
494 );
495 }
496 }
497
498
499 return $nav_urls;
500 }
501
502 /*static*/ function makeSpecialUrl( $name, $urlaction='' ) {
503 $title = Title::makeTitle( NS_SPECIAL, $name );
504 $this->checkTitle(&$title, &$name);
505 return $title->getLocalURL( $urlaction );
506 }
507 /*static*/ function makeTalkUrl ( $name, $urlaction='' ) {
508 $title = Title::newFromText( $name );
509 $title = $title->getTalkPage();
510 $this->checkTitle(&$title, &$name);
511 return $title->getLocalURL( $urlaction );
512 }
513 /*static*/ function makeArticleUrl ( $name, $urlaction='' ) {
514 $title = Title::newFromText( $name );
515 $title= $title->getSubjectPage();
516 $this->checkTitle(&$title, &$name);
517 return $title->getLocalURL( $urlaction );
518 }
519 /*static*/ function makeI18nUrl ( $name, $urlaction='' ) {
520 $title = Title::newFromText( wfMsg($name) );
521 $this->checkTitle(&$title, &$name);
522 return $title->getLocalURL( $urlaction );
523 }
524 /*static*/ function makeUrl ( $name, $urlaction='' ) {
525 $title = Title::newFromText( $name );
526 $this->checkTitle(&$title, &$name);
527 return $title->getLocalURL( $urlaction );
528 }
529
530 # make sure we have some title to operate on, mind the '&'
531 /*static*/ function checkTitle ( &$title, &$name ) {
532 if(!is_object($title)) {
533 $title = Title::newFromText( $name );
534 if(!is_object($title)) {
535 $title = Title::newFromText( '<error: link target missing>' );
536 }
537 }
538 }
539
540
541 }
542
543 class SkinDaVinci extends SkinPHPTal {
544 function initPage( &$out ) {
545 SkinPHPTal::initPage( $out );
546 $this->skinname = "davinci";
547 }
548 }
549
550 class SkinMono extends SkinPHPTal {
551 function initPage( &$out ) {
552 SkinPHPTal::initPage( $out );
553 $this->skinname = "mono";
554 }
555 }
556
557 class SkinMonoBook extends SkinPHPTal {
558 function initPage( &$out ) {
559 SkinPHPTal::initPage( $out );
560 $this->skinname = "monobook";
561 }
562 }
563
564 ?>